package com.zoranjoka.chordis.pages;

import java.util.List;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.hibernate.annotations.CommitAfter;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.zoranjoka.chordis.dao.ArtistDAO;
import com.zoranjoka.chordis.pages.edit.EditArtist;


public class Artist {

	@Inject
	private ArtistDAO dataArtist;
	@InjectPage
	private EditArtist editArtistPage;
	
	@Property
	private com.zoranjoka.chordis.entities.Artist a;
	@Property
	private List<com.zoranjoka.chordis.entities.Artist> artists;
	
	void onActivate()
	{
		artists = dataArtist.getAll();
	}
	
	@OnEvent(component="deleteArtist")
	@CommitAfter
	void deleteArtist(long id)
	{
		a = dataArtist.findById(id);
		dataArtist.delete(a);
	}
	
	


}
